// import {getDeviceInfo} from '@tarojs/taro';

// @ts-ignore
export const isH5 = TARO_ENV === 'h5';
// @ts-ignore
export const isWeapp = TARO_ENV === 'weapp';

// @ts-ignore
export const env = {dev: 'dev', local: 'dev', pre: 'pre', prod: 'prod'}[API_ENV] || 'prod';
export const isDev = env === 'dev';
export const isPre = env === 'pre';
export const isProd = !isDev && !isPre;

/** 设备信息 */
// export const deviceInfo = getDeviceInfo();
// export const isIos = (deviceInfo.system || '').toLowerCase().indexOf('ios') >= 0;
// export const isAndroid = (deviceInfo.system || '').toLowerCase().indexOf('android') >= 0;
/** 浏览器ua，只在H5下生效 */
export const userAgent = isH5 ? window.navigator.userAgent : '';
/** 当前页面为微信打开h5中，H5下生效 */
export const isWechatH5 = /micromessenger/i.test(userAgent);
/** 在小程序webview中，H5下生效 */
export const isWxMiniApp = globalThis.__wxjs_environment === 'miniprogram';
/** 微博环境 */
export const isWeiBo = /WeiBo/i.test(userAgent);
/** 钉钉环境 */
export const isDing = /DingTalk/i.test(userAgent);

/** 请求域名 */
export const domain = {
    /** 获取主站环境 */
    www: isDev ? 'https://md.nowcoder.com' : isPre ? 'https://prem.nowcoder.com' : 'https://www.nowcoder.com',
    /** 获取牛聘环境 */
    nowpick: isDev ? 'https://mdnowpick.nowcoder.com' : isPre ? 'https://premnowpick.nowcoder.com' : 'https://mnowpick.nowcoder.com'
};
